/*
 * PGStudent.cpp
 *
 *  Created on: Nov 18, 2012
 *      Author: monitz
 */
#include "../include/PGStudent.h"
#include "../include/Course.h"
using namespace std;

PGStudent::PGStudent(int ID, string path, int ELtodo) :
	Student(ID, path, ELtodo) {

}

void PGStudent::study(Course &c)
	{
	stringstream sstrm;
	sstrm << this->getID() << " is studying " << c.getDep() << " "<< c.getName() << endl;
	//treating not handling workload
	if (rand() % 5 == 0) {
		sstrm << ID << " is slacking of " << c.getName() << endl;;
		semester_succeed=false;
		/*if(c.getDep()=="EL")
		{
			c.eraseRegStudent(*this);
			this->retELtodo();
		}*/
	} else {

		if (rand() % 101 >= c.getMinimum()) {
			c.eraseRegStudent(*this);
			sstrm << ID << " took " << c.getName() << " and finished SUCCESSFULLY"<<endl;

		}
		else
		{
			sstrm << ID << " took " << c.getName() << " and finished UNSUCCESSFULLY"<<endl;
			semester_succeed=false;
			/*if(c.getDep()=="EL")
				{
					c.eraseRegStudent(*this);
					this->retELtodo();
				}*/
		}
	}
	log(sstrm);
	}

PGStudent::~PGStudent() {

}


string PGStudent::getDepartment()
{
	return "PG";
}
